home *** CD-ROM | disk | FTP | other *** search
- ' 1. stuffs a label and some values in cells
- ' 2. creates a named range
- ' 3. creates a formula
- ' 4. and stores the Value in the VB variable foo
-
- ' Declarations
- Dim XL As object
- Dim appXL As object
-
- Dim ws As object
- Dim sheet As object
- Dim cell As object
-
- ' Code
- Set XL = CreateObject("ExcelApplication")
- Set appXL = XL.Application
- appXL.Workbooks.Add
- Set ws = appXL.ActiveSheet
- ws.Cells(1,1).Value = "Test"
- ws.Cells(2,1).Value = 100
- ws.Range("A2:A5").FillDown
- tmp = ws.Range("A1:B5").CreateNames(True, False, False, False)
- Set cell = ws.Range("A6")
- cell.FormulaR1C1 = "=SUM(Test)"
- foo = cell.Value
-